<script setup>
import useStore from '../store'
import { storeToRefs } from 'pinia'
const { todoList } = useStore()
const { action, newList } = storeToRefs(todoList)
</script>

<template>
  <footer class="footer">
    <span class="todo-count"
      ><strong>{{ newList.length }}</strong> item left</span
    >
    <ul class="filters">
      <li>
        <a
          @click="todoList.setAction('all')"
          :class="{ selected: action === 'all' }"
          href="#/"
          >All</a
        >
      </li>
      <li>
        <a
          @click="todoList.setAction('active')"
          :class="{ selected: action === 'active' }"
          href="#/active"
          >Active</a
        >
      </li>
      <li>
        <a
          @click="todoList.setAction('completed')"
          :class="{ selected: action === 'completed' }"
          href="#/completed"
          >Completed</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="todoList.clearDone">
      Clear completed
    </button>
  </footer>
</template>

<style lang="less" scoped></style>
